﻿using System;
using System.Linq;
using Microsoft.Win32;

namespace Mipic.Infrastructure.Services
{
    public class ModalOpenFileDialog : IOpenFileDialogService
    {
        private readonly OpenFileDialog _dialog = new OpenFileDialog();

        /// <summary>
        /// Shows the dialog.
        /// </summary>
        /// <param name="defaultExt">The default extension.</param>
        /// <param name="filter">The filter.</param>
        /// <returns>Path to selected file.</returns>
        public string ShowDialog(string defaultExt, string filter)
        {
            _dialog.DefaultExt = defaultExt;
            _dialog.Filter = filter;

            _dialog.ShowDialog();

            return _dialog.FileName;
        }
    }
}
